package models;

import com.et.ar.ActiveRecordBase;
import com.et.ar.annotations.Column;
import com.et.ar.annotations.Id;
import com.et.ar.annotations.Table;

@Table(name="nodes")
public class Node extends ActiveRecordBase{
	@Id public Integer id;
	@Column public Integer parentId;
	@Column public String name;
	
	public boolean hasChildren() throws Exception{
		long count = count(Node.class, "parentId=?", new Object[]{id});
		return count > 0;
	}
}
